package com.tx.websocket.demo.model;


import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class BaseResource implements Serializable {

    /**
     * 数据库类型：bigint(20)
     */
    private Long id;

    /**
     * 父级菜单
     * 数据库类型：bigint(20)
     */
    private Long parentId;

    /**
     * 菜单名称
     * 数据库类型：varchar(255)
     */
    private String name;

    /**
     * URL地址
     * 数据库类型：varchar(256)
     */
    private String url;

    /**
     * 图标
     */
    private String icon;

    /**
     * 菜单类型
     * 数据库类型：tinyint(1)
     */
    private Integer type;

    /**
     * 是否启用，1：启用，0：关闭
     * 数据库类型：bit(1)
     */
    private Boolean enable;

    /**
     * 权限标志，可用于shiro注解
     * 数据库类型：varchar(255)
     */
    private String permMark;

    /**
     * 排序顺序
     * 数据库类型：int(11)
     */
    private Integer sortOrder;

    /**
     * 描述
     * 数据库类型：varchar(512)
     */
    private String remark;

    /**
     * 是否需要权限控制,1：需要，0：不需要
     * 数据库类型：bit(1)
     */
    private Boolean needPrem;

    /**
     * 是否已经被角色拥有
     */
    private Boolean beHave = false;

    private List<BaseResource> subResources = new ArrayList<>();

    public void setId(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getUrl() {
        return url;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getType() {
        return type;
    }

    public void setEnable(Boolean enable) {
        this.enable = enable;
    }

    public Boolean getEnable() {
        return enable;
    }

    public void setPermMark(String permMark) {
        this.permMark = permMark;
    }

    public String getPermMark() {
        return permMark;
    }

    public void setSortOrder(Integer sortOrder) {
        this.sortOrder = sortOrder;
    }

    public Integer getSortOrder() {
        return sortOrder;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getRemark() {
        return remark;
    }

    public void setNeedPrem(Boolean needPrem) {
        this.needPrem = needPrem;
    }

    public Boolean getNeedPrem() {
        return needPrem;
    }

    public List<BaseResource> getSubResources() {
        return subResources;
    }

    public void setSubResources(List<BaseResource> subResources) {
        this.subResources = subResources;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public Boolean getBeHave() {
        return beHave;
    }

    public void setBeHave(Boolean beHave) {
        this.beHave = beHave;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        BaseResource that = (BaseResource) o;

        return id.equals(that.id);
    }

    @Override
    public int hashCode() {
        return id.hashCode();
    }
}
